import request from '@/utils/request'
import {isEmptyString} from "@/utils/common";

// 律师入驻
export function lawyerSettled({
                                  address,
                                  certificate,
                                  company,
                                  info,
                                  judgment,
                                  name,
                                  num,
                                  phone,
                                  professionalPhoto,
                                  qrCode
                              }) {
    return request({
        url: '/lawyer/save',
        method: 'post',
        data: {
            address,
            certificate,
            company,
            info,
            judgment,
            name,
            num,
            phone,
            professionalPhoto,
            qrCode,
        }
    })
}

//律师列表
export function lawyerList({page, size}) {
    return request({
        url: '/team/list?current=' + page + '&size=' + size,
        method: 'get',
    })
}

//律师详情
export function lawyerDetail(id) {
    return request({
        url: '/team/info?id=' + id,
        method: 'get',
    })
}

//根据用户id查询律师信息
export function lawyerInfo(id) {
    return request({
        url: '/team/infoByUserId?userId=' + id,
        method: 'get',
    })
}

//编辑律师信息
export function lawyerEdit(params) {
    return request({
        url: '/team/update',
        method: 'post',
        data: params
    })
}

//查看当前律师的订单
export function lawyerOrder({current, size, orderState}) {
    if (isEmptyString(orderState)) {
        return request({
            url: '/team/getLawyerOrder?current=' + current + '&size=' + size,
            method: 'get',
        })
    }else{
        return request({
            url: '/team/getLawyerOrder?current=' + current + '&size=' + size + '&orderState=' + orderState,
            method: 'get',
        })
    }
}
//根据订单id修改订单状态
export function updateOrderState({orderId, orderState}) {
    return request({
        url: '/team/changeOrderState?orderId=' + orderId + '&orderState=' + orderState,
        method: 'get',
    })
}